﻿//Write a method that counts how many times given number appears in given array. Write a test program to check if the method is working correctly.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RepeatingNumInArr
{
    class RepeatingNumInArr
    {
        public static int Number;
        public static int counter = 0;
        static void Main(string[] args)
        {
            Console.Write("N:");
            int N = int.Parse(Console.ReadLine());
            Console.Write("Number:");
            Number = int.Parse(Console.ReadLine());
            int[] arr = new int[N];
            for (int i = 0; i < arr.Length; i++)
            {
                arr[i] = int.Parse(Console.ReadLine());
            }
            Console.WriteLine(NumAppear(arr));
        }

        public static int NumAppear(int[] arr)
        {
            for (int i = 0; i < arr.Length; i++)
            {
                if (arr[i] == Number)
                {
                    counter++;
                }
            }
            return counter;
        }
    }
}
